Image recomposition from face detection and facial features

ABSTRACT

A computer implemented method for modifying a digital image comprising identifying two or more individual regions in the digital image that each include a human face, and digitally defining at least one combined region that includes the two or more individual regions wherein at least one border of the at least one combined region is collinear with a border of one of the individual regions.

CROSS-REFERENCE TO RELATED APPLICATIONS

-   Jiebo Luo, Robert T. Gray, and Edward B. Gindele, “Producing an    Image of a Portion of a Photographic Image onto a Receiver using a    Digital Image of the Photographic Image”, U.S. Pat. No. 6,545,743;-   Jiebo Luo, “Automatically Producing an Image of a Portion of a    Photographic Image”, U.S. Pat. No. 6,654,507;-   Jiebo Luo, Robert T. Gray, “Method for Automatically Creating    Cropped and Zoomed Versions of Photographic Images”, U.S. Pat. No.    6,654,506;-   Jiebo Luo, “Method and Computer Program Product for Producing an    Image of a Desired Aspect Ratio”, U.S. Pat. No. 7,171,058.

The U.S. Patents listed above are assigned to the same assignee hereof,Eastman Kodak Company of Rochester, N.Y., and contain subject matterrelated, in certain respect, to the subject matter of the presentapplication. The above-identified patents are incorporated herein byreference in their entirety.

FIELD OF THE INVENTION

This invention relates to digital image enhancement, and moreparticularly to methods and apparatuses for automatically generatingpleasing compositions of digital images using locations and sizes offaces in the digital images.

BACKGROUND OF THE INVENTION

In the field of photography, in particular digital photography, amateurphotographers have little or no training on how to take photos ofpleasing composition. The resulting photographs they take are often illcomposed. It would be beneficial if a digital image processing algorithmcould recompose the original shot such that it represented the shot thatthe photographer had wished he/she had taken in the first place.Furthermore, even if the photographer captured a pleasing composition,it is often desired to display or print that photograph with a differingaspect ratio. This is typically accomplished by digitally cropping thedigital photograph. For example, many consumer digital cameras have a4:3 aspect ratio, while many new televisions have a 16:9 aspect ratio.The task of indiscriminately trimming (without regard to content) the4:3 aspect ratio to a 16:9 aspect ratio often eliminates image contentat the top and bottom of an image and so can cut off faces of persons inthe image or otherwise obscures portions of the main subject in theimage. It is currently common to capture imagery using a smart phone. Byholding the camera in a landscape or a portrait orientation, the aspectratio of the captured picture can vary quite a bit. Further, aftersharing this photo with a friend, upon opening up the image on thefriend's computer, or another device, the aspect ratio of the displaydevice or of the displayed photo will often be different yet again.Further, uploading the image to a social website may crop the image inan undesirable fashion yet again. All of these examples illustrate casesthat could benefit from the invention described herein.

Several main subject detection algorithms have been programmed toextract what is determined to be the main subject of a still digitalimage. For example, U.S. Pat. No. 6,282,317 describes a method toautomatically segment a digital image into regions and create a beliefmap corresponding to the importance of each pixel in the image. Mainsubject areas have the highest values in the belief map. Using thisbelief map, a more pleasing composition, or a preferred re-compositioninto a different aspect ratio of the input image is often attainable.However, despite using complex rules and sophisticated learningtechniques, the main subject is often mislabeled and the computationalcomplexity of the algorithm is generally quite significant.

It is desirable to create both a more robust, and a less computeintensive algorithm for generating aesthetically pleasing compositionsof digital images. In consumer photography, surveys have shown that thehuman face is by far the most important element to consumers. Facedetection algorithms have become ubiquitous in digital cameras and PCs,with speeds less than 50 ms on typical PCs. Several main subjectdetection algorithms capitalize on this, and often treat human faceareas as high priority areas. For example, U.S. Pat. No. 6,940,545describes an automatic face detection algorithm and then furtherdescribes how the size and location of said faces might feed measuredvariables into an auto zoom crop algorithm. U.S. Pat. No. 7,317,815describes the benefits of using face detection information not only forcropping, but for focus, tone scaling, structure, and noise. When facedetection information is bundled with existing main subject detectionalgorithms, the resulting beneficial performance is increased.Unfortunately, although this improvement has resulted in more pleasingcontributions overall, it fails to recognize that human faces are muchmore important than other image components. As a result, thesealgorithms do not adequately incorporate face information and, instead,emphasize other main subject predictors. For baseline instantiations,face information could be limited to facial size and location, but forsuperior performance face information can be expanded to include facialpose, blink, eye gaze, gesture, exposure, sharpness, and subjectinterrelationships. If no faces are found in an image, or if found facesare deemed irrelevant, only then is reverting back to a main subjectdetection algorithm a good strategy for arranging aesthetically pleasingcompositions.

What is needed are methods and apparatuses that will automaticallyconvert complex digital facial information into a pleasing composition.Efficient algorithms designed to accomplish these goals will result inmore robust performance at a lower CPU cost.

SUMMARY OF THE INVENTION

A preferred embodiment of the present invention comprises a computerimplemented method for modifying a digital image comprising loading thedigital image into an electronic memory accessible by the computer,identifying two or more individual regions in the digital image thateach include a human face, and digitally defining at least one combinedregion that includes the two or more individual regions, wherein atleast one border of the at least one combined region is collinear with aborder of one of the individual regions. Further, the method can bemodified wherein each of the borders of the at least one combined regionis collinear with at least one border of the individual regions.

Another preferred embodiment of the present invention comprises acomputer implemented method for modifying a digital image comprisingloading the digital image into an electronic memory accessible by thecomputer, identifying at least one individual region in the digitalimage that includes a human face, automatically modifying the digitalimage such that the individual region satisfies a broad rule of thirdsrule, and automatically modifying an aspect ratio of the digital imagesuch that, if possible, the at least one individual region is preservedwithout removing any of its pixels.

It has the additional advantages that the padding around faces changesas the input and output aspect ratio; that the low priority bounding boxbe constrained to pleasing composition rules; that the low prioritybounding box be attenuated if it is determined that the input digitalimage was already cropped or resampled; that in softcopy viewingenvironments it displays a multiple of output images, each aestheticallypleasing based upon composition, subject, or clusters of subjects.

These, and other, aspects and objects of the present invention will bebetter appreciated and understood when considered in conjunction withthe following description and the accompanying drawings. It should beunderstood, however, that the following description, while indicatingpreferred embodiments of the present invention and numerous specificdetails thereof, is given by way of illustration and not of limitation.For example, the summary descriptions above are not meant to describeindividual separate embodiments whose elements are not interchangeable.In fact, many of the elements described as related to a particularembodiment can be used together with, and possibly interchanged with,elements of other described embodiments. Many changes and modificationsmay be made within the scope of the present invention without departingfrom the spirit thereof, and the invention includes all suchmodifications. The figures below are intended to be drawn neither to anyprecise scale with respect to relative size, angular relationship, orrelative position nor to any combinational relationship with respect tointerchangeability, substitution, or representation of an actualimplementation.

In addition to the embodiments described above, further embodiments willbecome apparent by reference to the drawings and by study of thefollowing detailed description.

BRIEF DESCRIPTION OF THE DRAWINGS

Preferred embodiments of the present invention will be more readilyunderstood from the detailed description of exemplary embodimentspresented below considered in conjunction with the attached drawings, ofwhich:

FIG. 1 illustrates components of an apparatus and system for modifying adigital image according to a preferred embodiment of the presentinvention.

FIG. 2 illustrates a computer system embodiment for modifying a digitalimage according to a preferred embodiment of the present invention.

FIG. 3 illustrates a stepwise example of an automatic re-composition ofa digital image according to an embodiment of the present invention.

FIG. 4 illustrates another example of an automatic re-composition of adigital image according to an embodiment of the present invention.

FIGS. 5A-5C illustrate algorithms according to an embodiment of thepresent invention.

FIGS. 6A-6B illustrate a stepwise algorithm according to an embodimentof the present invention.

FIG. 7 illustrates a stepwise algorithm according to an embodiment ofthe present invention.

FIG. 8 illustrates a stepwise algorithm according to an embodiment ofthe present invention.

FIG. 9 illustrates a stepwise algorithm according to an embodiment ofthe present invention.

FIG. 10 illustrates a stepwise algorithm according to an embodiment ofthe present invention.

FIG. 11 illustrates a padding function according to an embodiment of thepresent invention.

FIG. 12 illustrates a padding example according to an embodiment of thepresent invention.

FIG. 13 illustrates a padding example according to an embodiment of thepresent invention.

FIG. 14 illustrates a padding example according to an embodiment of thepresent invention.

FIG. 15 illustrates a padding example according to an embodiment of thepresent invention.

FIG. 16 illustrates a bottom padding function according to an embodimentof the present invention.

FIG. 17 illustrates a bottom padding function according to an embodimentof the present invention.

FIG. 18 illustrates an example of a bottom padding function according toan embodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Preferred embodiments of the present invention describe systems,apparatuses, algorithms, and methods of a fully-automatic means ofdetermining and generating a pleasing re-composition of an input digitalimage. These are applicable to any desired (user requested) outputaspect ratio given an input digital image of any aspect ratio. If thedesired output aspect ratio matches the given input aspect ratio, thedetermination may be considered a zoomed re-composition. If the desiredoutput aspect ratio is different from the given input aspect ratio, thismay be considered a constrained re-composition. If the output aspectratio is unconstrained, this may be considered an unconstrainedre-composition. These automatic re-compositions are described herein.

FIG. 1 illustrates in a generic schematic format a computing system forimplementing preferred embodiments of the present invention. Electronicapparatus and processing system 100 is used for automaticallyrecompositing digital images. In a preferred embodiment as illustratedin FIG. 1, electronic computing system 100 comprises a housing 125 andlocal memory or storage containing data files 109, optional remote userinput devices 102-104, local user input devices 118-119, an optionalremote output system 106, and a local output system 117, wherein allelectronics are either hardwired to processor system 116 or optionallyconnected wirelessly thereto via Wi-Fi or cellular through communicationsystem 115. Output systems 106 and 117 depict display screens and audiospeakers. While these displays and speakers are illustrated asstandalone apparatuses, each can also be integrated into a hand heldcomputing system such as a smart phone. The computer system 100 mayinclude specialized graphics subsystem to drive output display 106, 117.The output display may include a CRT display, LCD, LED, or other forms.The connection between communication system 115 and the remote I/Odevices is also intended to represent local network and internet(network) connections to processing system 116. Various output productsin final form produced by the algorithms described herein, eithermanually or automatically, may be optionally intended as a final outputonly on a digital electronic display, not intended to be printed, suchas on output systems 106, 117, which are depicted herein as exampledisplays and are not limited by size or structure as may be implied bytheir representation in the Figures herein. Optional remote memorysystem 101 can represent network accessible storage, and storage such asused to implement cloud computing technology. Remote and local storage(or memory) illustrated in FIG. 1 can be used as necessary for storingcomputer programs and data sufficient for processing system 116 toexecute the algorithms disclosed herein. Data systems 109, user inputsystems 102-104 and 118-119 or output systems 106 and 117, and processorsystem 116 can be located within housing 125 or, in other preferredembodiments, can be individually located in whole or in part outside ofhousing 125.

Data systems 109 can include any form of electronic or other circuit orsystem that can supply digital data to processor system 116 from whichthe processor can access digital images for use in automaticallyimproving the composition of the digital images. In this regard, thedata files delivered from systems 109 can comprise, for example andwithout limitation, programs, still images, image sequences, video,graphics, multimedia, and other digital image and audio programs such asslideshows. In the preferred embodiment of FIG. 1, sources of data filesalso include those provided by sensor devices 107, data received fromcommunication system 115, and various detachable or internal memory andstorage devices coupled to processing system 116 via systems 109.

Sensors 107 are optional and can include light sensors, audio sensors,image capture devices, biometric sensors and other sensors known in theart that can be used to detect and record conditions in the environmentof system 100 and to convert this information into a digital form foruse by processor system 116. Sensors 107 can also include one or moresensors 108 that are adapted to capture digital still or video images.Sensors 107 can also include biometric or other sensors for measuringhuman voluntary and involuntary physical reactions, such sensorsincluding, but not limited to, voice inflection detection, bodymovement, eye movement, pupil dilation, body temperature, and p10900wave sensors.

Storage/Memory systems 109 can include conventional memory devices suchas solid state, magnetic, HDD, optical or other data storage devices,and circuitry for reading removable or fixed storage media.Storage/Memory systems 109 can be fixed within system 100 or can beremovable, such as HDDs and floppy disk drives. In the embodiment ofFIG. 1, system 100 is illustrated as having a hard disk drive (HDD) 110,disk drives 111 for removable disks such as an optical, magnetic orspecialized disk drives, and a slot 114 for portable removable memorydevices 112 such as a removable memory card, USB thumb drive, or otherportable memory devices, including those which may be included internalto a camera or other handheld device, which may or may not have aremovable memory interface 113 for communicating through memory slot114. Although not illustrated as such, memory interface 113 alsorepresents a wire for connecting memory devices 112 to slot 114. Dataincluding, but not limited to, control programs, digital images,application programs, metadata, still images, image sequences, video,graphics, multimedia, and computer generated images can also be storedin a remote memory system 101, as well as locally, such as in a personalcomputer, network server, computer network or other digital system suchas a cloud computing system. Remote system 101 is shown coupled toprocessor system 116 wirelessly, however, such systems can also becoupled over a wired network connection or a mixture of both.

In the embodiment shown in FIG. 1, system 100 includes a communicationsystem 115 that in this embodiment can be used to communicate with anoptional remote memory system 101, an optional a remote display 106,and/or optional remote inputs 102-104. A remote input station includingremote display 106 and/or remote input controls 102-104 communicateswith communication system 115 wirelessly, as illustrated, or cancommunicate as a wired network. Local input station including either orboth a local display system 117 and local inputs can be connected toprocessor system 116 using a wired (illustrated) or wireless connectionsuch as Wi-Fi or infra red transmission.

Communication system 115 can comprise for example, one or more optical,radio frequency or other transducer circuits or other systems thatconvert image and other data into a form that can be conveyed to aremote device such as remote memory system 101 or remote display device106 configured with digital receiving apparatus, using an opticalsignal, radio frequency signal or other form of signal. Communicationsystem 115 can also be used to receive a digital image and other digitaldata from a host or server computer or network (not shown) or a remotememory system 101. Communication system 115 provides processor system116 with information and instructions from corresponding signalsreceived thereby. Typically, communication system 115 will be adapted tocommunicate with the remote memory system 101, or output system 106 byway of a communication network such as a conventional telecommunicationor data transfer network such as the interne, a cellular, peer-to-peeror other form of mobile telecommunication network, a local communicationnetwork such as wired or wireless local area network or any otherconventional wired or wireless data transfer system.

User input systems provide a way for a user of system 100 to provideinstructions, or selections via a customized user interface, toprocessor system 116. This allows such a user to select digital imagefiles to be used in automatically recompositing digital images and toselect, for example, an output format for the output images. User inputsystem 102-104 and 118-119 can also be used for a variety of otherpurposes including, but not limited to, allowing a user to select,manually arrange, organize and edit digital image files to beincorporated into the image enhancement routines described herein, toprovide information about the user or audience, to provide annotationdata such as voice and text data, to identify and tag characters in thecontent data files, to enter metadata not otherwise extractable by thecomputing system, and to perform such other interactions with system 100as will be described herein.

In this regard user input systems 102-104 and 118-119 can comprise anyform of transducer or other device capable of receiving an input from auser and converting this input into a form interpreted by processorsystem 116. For example, user input system can comprise a touch screeninput at 106 and 117, a touch pad input, a 4-way switch, a 6-way switch,an 8-way switch, a stylus system, a trackball system or mouse such as at103 and 118, a joystick system, a voice recognition system such as at108, a gesture recognition system such as at 107, a keyboard, a remotecontrol 102, cursor direction keys, on screen keyboards, or other suchsystems. In the embodiment shown in FIG. 1, remote input system can takea variety of forms, including, but not limited to, a remote keyboard104, a remote mouse 103, and a remote control 102. Local input systemincludes local keyboard 119, a local mouse 118, microphone 108, andother sensors 107, as described above.

Additional input or output systems 121 are used for obtaining orrendering images, text or other graphical representations. In thisregard, input/output systems 121 can comprise any conventional structureor system that is known for providing, printing or recording images,including, but not limited to, printer 123 and, for example, scanner122. Printer 123 can record images on a tangible surface using a varietyof known technologies including, but not limited to, conventional fourcolor offset separation printing. Other contact printing such as silkscreening can be performed or dry electrophotography such as is used inthe NexPress 2100 printer sold by Eastman Kodak Company, Rochester,N.Y., USA, thermal printing technology, drop on demand ink jettechnology, and continuous inkjet technology, or any combination of theabove which is represented at 122-124. For the purpose of the followingdiscussions, printer 123 will be described as being of a type thatgenerates color images printed upon compatible media. However, it willbe appreciated that this is not required and that the methods andapparatuses described and claimed herein can be practiced with a printer123 that prints monotone images such as black and white, grayscale orsepia toned images.

In certain embodiments, the source of data files 109, user input systems102-104 and output systems 106, 117, and 121 can share components.Processor system 116 operates system 100 based upon signals from userinput system 102-104 and 118-119, sensors 107-108, storage/memory 109and communication system 115. Processor system 116 can include, but isnot limited to, a programmable digital computer, a programmablemicroprocessor, a programmable logic processor, multi-processingsystems, a chipset, a series of electronic circuits, a series ofelectronic circuits reduced to the form of an integrated circuit, or aseries of discrete components on a printed circuit board.

As will be described below, processing system 100 can be configured as aworkstation, laptop, kiosk, PC, and hand held devices such as camerasand smart phones. As an exemplary workstation, the computer systemcentral processing unit 116 communicates over an interconnect bus 105.The CPU 116 may contain a single microprocessor, or may contain aplurality of microprocessors for configuring the computer system 100 asa multi-processor system, and high speed cache memory comprising severallevels. The memory system 109 may include a main memory, a read onlymemory, mass storage devices such as tape drives, or any combinationthereof. The main memory typically includes system dynamic random accessmemory (DRAM). In operation, the main memory stores at least portions ofinstructions for executions by the CPU 116. For a workstation, forexample, at least one mass storage system 110 in the form of an HDD ortape drive, stores the operating system and application software. Massstorage 110 within computer system 100 may also include one or moredrives 111 for various portable media, such as a floppy disk, a compactdisc read only memory (CD-ROM or DVD-ROM), or an integrated circuitnon-volatile memory adapter 114 (i.e. PC-MCIA adapter) to provide andreceive instructions and data to and from computer system 100.

Computer system 100 also includes one or more input/output interfaces142 for communications, shown by way of example as an interface for datacommunications to printer 123 or another peripheral device 122-124. Theinterface may be a USB port, a modem, an Ethernet card or any otherappropriate data communications device. The physical communication linksmay be optical, wired, or wireless. If used for scanning, thecommunications enable the computer system 100 to receive scans from ascanner 122, or documentation therefrom, to a printer 123 or anotherappropriate output or storage device.

As used herein, terms such as computer or “machine readable medium”refer to any non-transitory medium that stores or participates, or both,in providing instructions to a processor for execution. Such a mediummay take many forms, including but not limited to, non-volatile mediaand volatile media. Non-volatile media include, for example, optical ormagnetic disks, flash drives, and such as any of the storage devices inany computer(s) operating as one of the server platforms, discussedabove. Volatile media include dynamic memory, such as main memory ofsuch a computer platform. Transitory physical transmission media includecoaxial cables; copper wire and fiber optics, including the wires thatcomprise a bus within a computer system, a carrier wave transportingdata or instructions, and cables or links transporting such a carrierwave. Carrier-wave transmission media can take the form of electric orelectromagnetic signals, or acoustic or light waves such as thosegenerated during radio frequency (RF) and infrared (IR) datacommunications. Common forms of non-transitory computer-readable mediatherefore include, for example: a floppy disk, a flexible disk, harddisk, magnetic tape, any other magnetic medium, a CD-ROM, DVD, any otheroptical medium, punch cards, paper tape, any other physical medium withpatterns of holes, a RAM, a PROM, and EPROM, a FLASH-EPROM, any othermemory chip or cartridge, or any other medium from which a computer canread programming code and/or data. Many of these forms of computerreadable media may be involved in carrying one or more sequences of oneor more instructions to a processor for execution.

As is illustrated in FIG. 2, an example implementation of the processingsystem just described is embodied as example workstation 200 andconnected components as follows. Processing system 200 and local userinput system 218-222 can take the form of an editing studio or kiosk 201(hereafter also referred to as an “editing area”), although thisillustration is not intended to limit the possibilities as described inFIG. 1 of potential implementations. Local storage or memory 209 cantake various forms as described above with regard to data systems 109.In this illustration, a user 202 is seated before a console comprisinglocal keyboard 219 and mouse 218 and a local display 217 which iscapable, for example, of displaying multimedia content. As is alsoillustrated in FIG. 2, the editing area can also have sensors 220-222including, but not limited to, audio sensors 220, camera or videosensors 222, with built in lenses 221, and other sensors such as, forexample, multispectral sensors that can monitor user 202 during a userproduction session. Display 217 can be used as a presentation system forpresenting output products or representations of output products infinal form or as works-in-progress. It can present output content to anaudience, such as user 202, and a portion of sensors 221, 222 can beadapted to monitor audience reaction to the presented content. It willbe appreciated that the material presented to an audience can also bepresented to remote viewers.

1.0 Modification Conditions

A need for re-composition commonly occurs when there is an aspect ratiomismatch between an input digital image and a desired recompositedoutput aspect ratio for the digital image. As used herein, an inputdigital image refers to a digital image that is to be recomposited usingthe methods and apparatuses described herein. This includes inputdigital images that are selected by users as input images to berecomposited. They can be unmodified digital images, i.e. unchanged fromtheir initial captured state, or previously modified using any of anumber of software products for image manipulation. An output imagerefers to a modified or adjusted digital image using the automaticre-composition methods and apparatuses described herein. These alsoinclude desired output aspect ratios as selected by users of thesemethods and apparatuses. For example, many digital cameras capture 4:3aspect ratio images. If the consumer wants to display this image on a16:9 aspect ratio television, digital frame, or other display apparatus,or create a 6″×4″ or 5″×7″ print to display in a picture frame, thedifference between the 4:3 input aspect ratio and the output displayareas needs to be rectified. This conversion is referred to as auto-trimand is pervasive in the field of photography. The simplest solution,which disregards image content, is to zoom in as little as possible suchthat the 16×9 output aspect ratio frame, also known as a crop mask orcrop box, is contained within in the original input image. Thistypically eliminates top and bottom border portions of the input image.FIG. 3 illustrates an input 4:3 image, 310, along with landscape (6×4)layout cropping, pre-crop and post-crop 320 and 330, respectively, andportrait (5×7) layout cropping, 340 and 350. The squares 326, 327, 346,347 illustrated in 320 and 340 are face boundaries (or face boxes) asdetermined by an automatic face detection algorithm and are superimposedover the images. These can be generated by a camera processing systemand displayed on a camera display screen or on a PC processing systemand displayed on a PC monitor, or other processing systems with adisplay, such as an iPad or similar portable devices. Images 320 and 330demonstrate a minimal zoom method for extracting a 6:4 crop area fromimage 310. When the output aspect ratio is greater than the input aspectratio (e.g. 6:4>4:3), the minimal zoom method necessitates cropping offportions of the top and bottom of the input image. A common rule ofthumb, typically programmed for automatic operation, is to crop 25% offthe top and 75% off the bottom (wherein the total image area to becropped or removed represents 100%) to minimize the possibility ofcutting off any heads of people in the photograph. The automaticallygenerated horizontal lines 321, 322 in image 320, the crop mask, showthe 6:4 crop area, and 330 illustrates the final cropped image. When theoutput aspect ratio is less than the input aspect ratio (e.g. 5:7<4:3),a programmed minimal zoom algorithm crops off portions at the left andright borders of the input image. The vertical lines 341, 342 in image340 show the automatically generated 5:7 crop area, and 350 demonstratesthe final cropped image. When cropping areas on the left and right, itis common to program a center crop algorithm, i.e. crop 50% off each ofthe left and right edges of the image (wherein the total image area tobe cropped or removed represents 100%). These methods of doing auto trimare blind to any image content but are fast and work well for manyscenes.

More desirable results can be obtained above and beyond the describedauto-trim method. If, for example, we had some knowledge of the mainsubject, we could program our crop box to be centered on this mainsubject. We could even selectively zoom in or out to just encompass themain subject, removing background clutter. Using the face box locations326, 327, 346, 347 illustrated in images 320 and 340, along with thedesired input and output aspect ratio, an alternate method of trimmingcan be performed—one which encompasses a selective zoom as well. Forexample, in FIG. 4, image 410 is the same image as image 310 of FIG. 3,image 430 is the same as image 330, and image 450 is the same as image350. Referring to FIG. 4, arguably better 6×4 and 5×7 compositions ofimages 430 and 450 are images 435 and 455, respectively. Images 435 and455 were created automatically using techniques of the present inventiondescribed herein.

A majority of keepsake photographic memories contain pictures of peopleand, as such, people are often the main subjects in images and so arecritical in fulfilling re-composition requests. Using computer methodsdescribed in the article “Rapid object detection using a boosted cascadeof simple features,” by P. Viola and M. Jones, in Computer Vision andPattern Recognition, 2001, Proceedings of the 2001 IEEE Computer SocietyConference, 2001, pp. I-511-I-518 vol. 1; or in “Feature-centricevaluation for efficient cascaded object detection,” by H. Schneiderman,in Computer Vision and Pattern Recognition, 2004; Proceedings of the2004 IEEE Computer Society Conference, 2004, pp. II-29-II-36, Vol. 2,the size and location of each face can be found within each image. Thesetwo documents are incorporated by reference herein in their entirety.Viola utilizes a training set of positive face and negative non-faceimages. Then, simple Haar-like wavelet weak classifier features arecomputed on all positive and negative training images. While no singleHaar-like feature can classify a region as face or non-face, groupingsof many features form a strong classifier that can be used to determineif a region is a face or not. This classification can work using aspecified window size. This window is slid across and down all pixels inthe image in order to detect faces. The window is enlarged so as todetect larger faces in the image. The process repeats until all faces ofall sizes are found in the image. Because this process can be quitecompute intensive, optimizations such as an integral image and cascadesof weak classifiers make the algorithm work faster. Not only will thisprocess find all faces in the image, it will return the location andsize of each face. These algorithms have been optimized such that theycan find all faces in real time on typical cameras, smart phones, iPads,PCs or other computing systems.

Once a face is found, neural networks, support vector machines, orsimilar classifying means can be trained to locate specific featuressuch as eyes, nose, and mouth; and then corners of eyes, eye brows,chin, and edge of cheeks can be found using geometric rules based uponanthropometric constraints such as those described in “Model Based Posein 25 Lines of Code”, by DeMenthon, Daniel F, Davis, Larry S.,Proceedings from the Image Understanding Workshop, 1992. Active shapemodels as described in “Active shape models—their training andapplication,” by Cootes, T. F. Cootes, C. J. Taylor, D. H. Cooper, andJ. Graham, Computer Vision and Image Understanding, vol. 61, pp. 38-59,1995, can be used to localize all facial features such as eyes, nose,lips, face outline, and eyebrows. These two documents are incorporatedby reference herein in their entirety. Using the features that are thusfound, it is possible to determine if eyes/mouth are open, or if theexpression is happy, sad, scared, serious, neutral, or if the person hasa pleasing smile. Determining pose uses similar extracted features, asdescribed in “Facial Pose Estimation Using a Symmetrical Feature Model”,by R. W. Ptucha, A. Savakis, Proceedings of ICME—Workshop on MediaInformation Analysis for Personal and Social Applications, 2009, whichdevelops a geometric model that adheres to anthropometric constraints.This document is incorporated by reference herein in its entirety. Withpose and expression information stored in association with each face,preferred embodiments of the present invention can be programmed to givemore weight towards some faces, for example, a person looking forwardwith a smile is more important than a person looking to the left with anexpression determined to be less desirable. Images having faces withmore weight can then be ranked and preferentially selected for anyproposed use. Ranked images can be identified and a sorted list can becompiled, stored, updated from time to time due to new images added to acollection, or because of new ranking algorithms. The sorted list can beaccessed for future use. As another example of preferential weighting,if a face or faces are looking to the left in an image, the cropped outarea for that image can be programmed to be biased toward the right. Forexample, a center crop algorithm, as described above, can be adjusted toassign more than 50% of the crop area to one side (right side, in thisexample) of the image.

In many instances there are no people depicted in an image, but there isa main subject that is not a person or that does not contain arecognizable face. A main subject detection algorithm, such as the onedescribed in U.S. Pat. No. 6,282,317, which is incorporated herein byreference in its entirety, can be used instead of or in conjunction withface detection algorithms to guide automatic zoomed re-composition,constrained re-composition, or unconstrained re-composition. Exemplarypreferred embodiments of such algorithms involve segmenting a digitalimage into a few regions of homogeneous properties such as color andtexture. Region segments can be grouped into larger regions based onsuch similarity measures. Regions are algorithmically evaluated fortheir saliency using two independent yet complementary types of saliencyfeatures—structural saliency features and semantic saliency features.The structural saliency features are determined by measurablecharacteristics such as location, size, shape and symmetry of eachregion in an image. The semantic saliency features are based uponprevious knowledge of known objects/regions in an image which are likelyto be part of foreground (for example, statues, buildings, people) orbackground (for example, sky, grass), using color, brightness, andtexture measurements. For example, identifying key features such asflesh, face, sky, grass, and other green vegetation by algorithmicprocessing are well characterized in the literature. The data for bothsemantic and structural types can be integrated via a Bayes net asdescribed in “Artificial Intelligence—A Modern Approach,” by Russell andNorvig, 2^(nd) Edition, Prentice Hall, 2003, to yield the final locationof the main subject. This document is incorporated by reference hereinin its entirety. Such a Bayes net combines the prior semanticprobability knowledge of regions, along with current structural saliencyfeatures into a statistical probability tree to compute the specificprobability of an object/region being classified as main subject orbackground. This main subject detection algorithm provides the locationof a main subject and the size of the subject as well.

Despite sophisticated processing, automated main subject detectors asdescribed above often miscalculate the main subject areas. Even iffacial regions are fed into the main subject detector and are identifiedas a high priority main subject belief map, the main subject areas foundby the main subject detector often downplay the importance of the facialareas. Human observers are so fascinated with faces, that the renditionof the faces in the final image often far outweigh any other subjectmatter in the scene, and so these prior methods and devices fall shortwith regard to the advantages provided by preferred embodiments of thepresent invention. As such, preferred embodiments of the presentinvention place less emphasis on the compute intensive main subjectdetection methods described above when faces are found in an image. Ithas been determined that using only face information for image croppingis both more robust and simpler to process. Only when no faces arefound, a preferred embodiment of the present invention reverts back tothe main subject detection methods or the auto-trim methods which crop25% off the top and 75% off the bottom, when cropping vertically, and50% off each side when cropping horizontally. Further, if there is someremaining compute power available, the facial understanding methods ofdetermining pose, blink, smile, etc., are not only less computeintensive than main subject detection but are much more effective atdetermining the final crop areas.

2.1 Formation of High and Medium Priority Regions

Referring to FIG. 5A, a preferred embodiment of the present inventionbegins by performing face detection. The present invention is notconstrained to using the particular face detection algorithmsincorporated by reference above. Various face detection algorithms arepresently found in digital cameras, for example, and highlight imageregions containing faces that a user can observe on a camera display.Image 510 shows a sample stylized version of an original image forpurposes of clarity in describing an operation of an embodiment of thepresent inventions. Image 520 shows that same sample image with facelocation and sizes denoted by the solid line face boxes 521-525. Iffaces are found, a preferred embodiment of the present invention sortsall found faces from largest to smallest. Faces with width less than orequal to a selectable α% of the largest face width can be programmed tobe ignored by the algorithm. In a preferred embodiment, α=33, therebyresulting in ignoring faces less than or equal to approximately 1/9^(th)the area of the largest face (using a square face box as anapproximation), however, other values for a can be programmablyselected. Remaining faces are “padded” on the top, bottom, left, andright, to demarcate an image area that is preferred not to be croppedboth for pleasing composition, and to ensure that the critical featuresof the face are not accidentally cropped in the final output image. Theamount of padding area is a function of the face size and input andoutput aspect ratio. In the following description, we assume the paddingabove, below, left, and right of the face box is equal to one facewidth. Section 6 will describe the precise methods used to determineactual padding amounts used by preferred embodiments of the presentinvention.

The two small face boxes, 524 and 525, toward the bottom right of theinput image 520 are smaller than 1/9^(th) the area of the largest facebox 522 in that image, and are thus ignored and are not used any furtherin the algorithm for this example. The combined face box area is shownas the dotted rectangle 535 in image 530. It is formed in reference tothe leftmost, rightmost, topmost, and bottommost borders of theremaining individual face boxes. It is digitally defined by thealgorithm and its location/definition can be stored in association withthe input image and with the output image. In the description thatfollows, these regions are illustrated as square or rectangular, whichsimplifies their definition and storage using horizontal and verticalcoordinates. This combined face box area will be referred to as the highpriority face box area or, in a shortened form, as the high priorityregion and can be, in some instances, the same as an individual face boxfor an image containing only one face box.

FIG. 5C illustrates a general face box size determination used bytypical face detection software. The algorithm initially determines adistance between two points D1 each in a central region of the eyes in aface found in the digital image. The remaining dimensions are computedas follows: the width of the face box D2=2*D1 symmetrically centeredabout the two points; the distance below the eyes H2=2*H1; the distanceabove the eyes H1=(⅔)*D1; therefore H2=(4/3)*D1.

Referring to FIG. 5B, the padding around the three faces forms paddedface boxes 541-543 in image 540 shown as dashed lines surrounding eachface box. The combined padded area forms a single face pad area 555shown in image 550. This combined face pad area, 555, is referred to asthe medium priority combined padded face box area or, in a shortenedform, the medium priority region. It is formed in reference to theleftmost, rightmost, topmost, and bottommost borders of the padded faceboxes. Using input aspect ratio, desired output aspect ratio andaesthetic rules, the medium priority region is expanded to form the lowpriority composition box area (described below), or the low priorityregion, denoted as the clear area, 567 in digital image 560.

Referring to FIG. 5A, if the two faces 524-525 in the lower right of 520were a little larger, their face width would be greater than α% of thelargest face width, and the algorithm would determine that they wereintended to be part of the original composition. FIG. 6A demonstratesthis scenario as the areas of faces 614 and 615 are each now larger than1/9^(th) of the area of the largest face 612 found in the image 610.Taking the leftmost, rightmost, topmost, and bottommost borders of all 5individual face boxes forms the borders of the high priority region 618.The padded faces 631-635, using a 1× face width as padding area, areshown in 630. When forming the medium priority region, we allow theformation of multiple medium priority regions. When using the leftmost,rightmost, topmost, and bottommost borders of the padded face boxes,each grouping of padded face boxes forms its own medium priority region,whereas groupings are defined by overlapping padded face boxes. Allpadded face boxes that overlap belong to a single group and thus definetheir own medium priority region. In FIG. 6A, we form two mediumpriority regions, 645 and 647. If, after padding the face boxes, we havetwo non-overlapping disjoint medium priority regions as shown by 645 and647 in image 640, the algorithm takes this data and recalculates thehigh priority region 618. In particular, the algorithm recalculates acorresponding high priority region to go along with each medium priorityregion, where groupings of faces that contribute to each medium priorityregion also contribute to their own high priority region shown as 625and 627 in image 620.

Similar to the criteria described above for ignoring face boxes lessthan or equal to α% of the largest face box, we include a secondcriteria at this point of the process by also ignoring all padded faceboxes having a width less than or equal to β% of the largest padded facebox. In a preferred embodiment β=5 with the result that padded faceboxes having an area less than or equal to approximately ¼ the area ofthe largest padded face box are ignored (using a square shapedapproximation for the padded face box). If medium priority regions areignored under this process, so are their corresponding high priorityregions. Non-discarded medium priority regions will be used to form thelow priority region using methods described below. However, theindividual padded face boxes 631-635 and medium priority regions 645 and647 are separately recorded and maintained by the algorithm for possiblefuture usage. For example, if the requested output was a 5:7 portraitlayout, it would be impossible to maintain both medium priority regions645 and 647 in their entirety. Rather than chop off the sides of both,or center weight based upon medium priority region size, a preferredmethod is to try to include as many medium priority regions as possiblein their entirety. In particular, the smallest medium priority regionsare ignored, one at a time, until the final constrained re-compositioncan encompass all remaining medium priority regions in their entirety.This will crop out some people from the picture, but, it will preservethe more important or larger face areas. In the case when one of two ormore equally sized medium priority regions are to be ignored, the morecentrally located face boxes are given priority. In the example image640, the final constrained re-composition output aspect ratio, 641 (notshaded) was quite similar to the input aspect ratio of 640. According tothe present algorithm, because padded face box 635 falls outside theinput image area, an equal amount is cropped from an opposite side ofthe combined padded face box region (medium priority region) formed by634 and 635, as explained in Section 6 with relation to FIG. 15.Therefore, both medium priority regions were able to fit within the lowpriority region 641 in image 640.

As previously described, faces that are too small (FIG. 5A, faces 524,525) are ignored. Alternatively, faces that exhibit undesirablecharacteristics can also be ignored (we discuss below how they can bemaintained in the initial formation of the low priority region, weightedlower, and then optionally ignored, based upon weight, during theformation of the final constrained aspect ratio crop box). Image 660 inFIG. 6B is identical to image 610 in FIG. 6A except that the largestface (662 in FIG. 6B and 612 in FIG. 6A) exhibits blinked eyes and anegative expression. Each face carries a weight or fitness value. Faceswith weights less than a percentage of the highest scoring face areignored, for example, faces less than 25% of the highest scoring face.Factors such as eye blink and expression will lower the fitness score of662 in FIG. 6B. Similarly, factors such as direction of eye gaze, headpitch, head yaw, head roll, exposure, contrast, noise, and occlusionscan similarly lower the fitness score of a face. Padded face box 682 inFIG. 6B has a corresponding low fitness score. In image 670, it isassumed the fitness score of face 662 was so low that it is ignored fromany further processing. In this case, padded faces 661 and 663 formpadded face boxes 695 and 696 that are not overlapping. Image 690 thenhas three medium priority regions, labeled 695, 696, and 697 (mediumpriority regions 684 and 685 were grouped together to form combinedmedium priority region 697).

2.2 Formation of Low Priority Region

Expanding from the medium priority region to the low priority regionwill now be described. This algorithm follows an extension of whatphotographers call the “rule of thirds”. Using the size and location ofa medium priority region, the algorithm determines if a rule of thirdscomposition can be applied to make a more pleasing display. Therule-of-thirds is a compositional rule that has proven to yield wellbalanced or natural looking prints in the averaged opinions of surveyedobservers. If an image is broken into an equally spaced 3×3 grid withtwo horizontal and two vertical lines, the aesthetic design idea is toplace the subject of interest (the medium face box in this example) onone of the four dividing lines, preferably at one of the fourintersecting points. In this example, the algorithm attempts to centerthe medium priority region on one of the four dividing lines. The sizeof the medium priority region and the spacing of the rule of thirdslines determines the low priority region according to the followingmethods.

Often, is not possible to center the medium priority region on one ofthese lines without a portion of the medium priority region fallingoutside the imagable area. If we cannot center our medium priorityregion on one of these dividing lines, and if the entire medium priorityregion is in the upper half of the image, the algorithm tries to expandthe medium priority region downward. Similarly, if the entire mediumpriority region is in the lower half, or left half, or right half, thealgorithm tries to expand the medium priority region upward, to theright, or to the left, respectively, in an attempt to make the resultingcomposition more pleasing. The amount of expansion is an adjustableparameter, strongly influenced according to whether the desired outputis landscape or portrait. When an output aspect ratio is specified, theup-down expansion is emphasized in portrait outputs, and left-rightexpansion is emphasized in landscape outputs. For example, if the outputimage display image is portrait in nature, the algorithm will favorexpanding the crop box in the vertical direction. If the output imagedisplay image is landscape in nature, the algorithm will favor expandingthe crop box in the horizontal direction.

As an example result of the algorithm, if the medium priority region isin the upper right quadrangle, the low priority region is initialized asbeing equal to the medium priority region. Then, for landscape outputimages, the left side is extended by twice the largest face width andthe bottom is extended by twice the largest face width to form the lowpriority region. For portrait images, neither the left or right side isextended, but the bottom is extended by three times the largest facewidth. Similar rules are used if the medium priority region is in theupper left quadrangle. If the medium priority region is in the lowerleft or right quadrangle and a landscape image is requested, the rightand left sides respectively are extended by twice the largest face widthand the upper boundary is extended by the 1× the largest face with toform the low priority region. If the medium priority region is in thelower left or right quadrangle and a portrait image is requested, theright and left sides are not extended but the upper boundary is extendedby the 1× the largest face width to form the low priority region. If themedium priority region is constrained to the left or right half of theinput image, we form the low priority region by expanding to the rightor left by 2× the largest face width. If the medium priority region isin the lower center of the input image, the low priority region isformed by expanding upward by 1× the largest face width. If the mediumpriority region is in the upper center half of the input image, the lowpriority region is formed by expanding downward by twice the largestface width for landscape images and three times the largest face widthfor portrait images. When there are multiple medium priority regions, aweighted combination is used to gauge the overall location of the mediumpriority region. This weighted combination can be based upon size,location and, as will be seen shortly, includes information about thefitness of the faces in each medium priority region.

In addition to using the above composition rules, the present algorithmincludes a parameter that indicates if the input image was composed byan expert or by an amateur. If the algorithm determines that previousmodification to a digital image was composed by an expert, the resultantchanges to the low priority region in the digital image performed by thealgorithm are biased towards the original input image boundaries. If thealgorithm determines that previous modification to a digital image wascomposed by an amateur, the resultant change to low priority region inthe digital image performed by the algorithm is not constrained(standard default mode). For example, if the (expert) photographermodified the digital image by placing the subject off center, the outputimage would retain a similar bias. To implement this, the algorithm cancontinuously adjust between using the full, automatically generated lowpriority region, and the original user modified image. In this method,the final four boundaries are a weighted sum between the two. Thedefault mode weights the automatically generated low priority regionboundaries to 1 and the original boundaries to 0. For expert mode, thealgorithm uses weights of 0.5 for both the algorithm determined lowpriority region and the previously modified image boundaries.

3.0 Formation of Constrained Aspect Ratio Crop Box

The resulting low priority region (expanded medium priority region)defines the optimal viewable area of the input image under thisalgorithm. Areas of the input image outside this box are consideredirrelevant portions of the input image and the algorithm ignores contentin these areas. When no output aspect ratio is specified, or when therequested aspect ratio matches the low priority region aspect ratio, thearea in the low priority region becomes the final output image. In caseswhere the output aspect ratio is specified and does not match this lowpriority region aspect ratio, preferred embodiments of the presentinvention serve to rectify the difference, as follows.

To rectify the difference, the constraining dimension is computed. Incases where the requested output aspect ratio is greater than the lowpriority region, the algorithm attempts to pad the low priority regionleft and right with the previously determined “irrelevant” portions ofthe input image. Similarly, in cases where the output aspect ratio isless than the low priority region, the algorithm attempts to pad the topand bottom with the “irrelevant” portions of the input image. Thechoices of expanding to the low priority region, rectifying aspect ratiomismatches, and padding choices are accomplished though a successiveseries of evaluations of low, medium, and high-priority regions.

When attempting to achieve the requested aspect ratio, there may not beenough irrelevant area to use as padding on the top or sides of the lowpriority region to achieve the requested aspect ratio. In this case, theedges of the image can be padded with non-content borders, the lowpriority region can be cropped, or we can use external image informationto extend the original image in the required direction. Padding withnon-content borders is not always visually appealing. Extending theoriginal image content from other images in the user's collection orfrom images on the web requires sophisticated scene matching andstitching. Selectively cutting into the low priority region is often thepreferred method but should be performed in a manner such that avisually aesthetically appealing cropped version of the low priorityregion is maintained. This is accomplished by center cropping on the lowpriority region as long as doing this does not delete any of the mediumpriority region. If any of the medium priority region would be croppedby this process, this may be avoided by centering the output image onthe medium priority region. If this shift does not crop the highpriority region, the result is considered satisfactory. If any of thehigh priority region would be cropped by this process, the output imageis centered on the high priority region. If this high priority region isnonetheless clipped, once again the image can be padded with borderssuch that none of the high priority region is cropped out of the finalimage, or portions of the high priority region can be cropped as a lastresort.

FIG. 7 shows an input digital image 710. The face boxes are shown in720. Using face padding rules, that are governed by face size, location,and aspect ratio as explained above, the medium priority region thatencompasses the padded face box areas is shown in 730 as the combinedpadded face box area. This medium priority region is then expanded forpleasing composition forming a low priority region as shown at 740 and750. The expansion direction and amount is dictated by the location andsize of the medium priority region as well as the requested outputaspect ratio. In image 740, both detected face boxes are in the upperleft quadrant and the requested output aspect ratio is a landscapeformat. As such, the cropping algorithm will expand the medium priorityregion toward the bottom and the right to form the low priority region.As explained above, had the face boxes been present in the upper rightquadrant, the cropping algorithm would have been biased to expand thecombined padded area to form the low priority region to the bottom andto the left. If facial pose or eye gaze is enabled, the algorithmcomputes vectors indicating the orientation for each face in the image.The average direction of the vectors is used to bias the low priorityregion formation in the direction, or average direction, in which thefaces are looking. If a landscape image is desired as an output format,decision box 760 results in expanding the medium priority regiondownward and to the right as in image 740. If a portrait image isdesired, decision box 760 results in expanding the medium priorityregion downward as in image 750. The resulting low priority region wouldbe considered the optimal pleasing composition of the input image ifthere were no output aspect ratio constraints. If there are no outputaspect ratio constraints, the low priority region defines the finalimage.

When there are specific output aspect ratio constraints, for example, arequested output format, then the algorithm rectifies any differencesbetween the low priority region and the output aspect ratio constraintsto form a constrained aspect ratio crop box. In general, content in thelow priority region is not sacrificed, if possible. As such, thecropping algorithm will form a constrained aspect ratio crop box insidethe low priority region equivalent to the specific requested outputaspect ratio constraint and keep growing this crop box until it fullyenvelops the low priority region. Unless the requested output aspectratio matches the low priority region, irrelevant portions of the inputimage will be included in the constrained aspect ratio output imageeither to the left and right of the low priority region, or to the topand bottom. As the input image irrelevant portions allow, theconstrained aspect ratio crop box is centered on the low priorityregion. However, if an image boundary at the top, bottom, left, or rightside of the input image is included in this centered low priorityregion, the algorithm allows the crop box to expand at the opposite sidewithout constraint so that only the original image content is includedin the final image. This allows the algorithm to avoid sacrificingpixels inside the low priority region and uses an original imageboundary as one of the final image boundaries, as it forms the finaloutput aspect ratio image.

For workflows in which a user has multiple input images that need to beinserted into multiple template openings of varying aspect ratios, thelow priority region aspect ratio becomes a key indicator of which imagesfit best into which template opening to accomplish the goal of fullyautomatic image template fulfillment. The low priority region aspectratio is compared to all template opening aspect ratios. The moresimilar the two aspect ratios, the better the fit.

FIG. 8 illustrates example output images, starting with image 710 havingaspect ratio 6:4 as input, when a landscape output aspect ratio isrequested, as in image 810, and when a portrait output aspect ratio isrequested, as in image 820. In both images, the detected face boxes 811,812, and the medium priority region, 815, 825, are the same. The lowpriority region, 816, 826, and the final output image with constrainedoutput aspect ratio, 817, 827 are also shown. In 817, the algorithm wasable to keep expanding to satisfy the final requested constrained outputaspect ratio box until its top and bottom borders matched the top andbottom borders of the low priority region, as explained above. In 827,the algorithm was also able to keep expanding to satisfy the finalconstrained output aspect ratio box until its left and right bordersmatched the left and right borders of the low priority region, asexplained above.

In both images 810 and 820, the algorithm fit the final constrainedoutput aspect ratio box as tightly around the low priority region aspossible. In some cases this may cause too much zoom in the image. Forexample, we can continue to expand the final constrained output aspectratio box in 810 and 820 until we hit a border of the image.Specifically, a user adjustable parameter is added to the algorithm suchthat this border can be as tight as possible to the low priority region,or as tight as possible to one of the image borders, or anywhere inbetween. This is the same algorithm as using the amateur (default) vs.professional cropping mode discussed earlier. In fact, if an informedestimate can be made about how much cropping the user would prefer, thisparameter can be adjusted on the fly automatically. For example, if allimages in a user's collection, except the current image, are 4:3 aspectratio, it may indicate that the user went out of his way to change thecurrent image aspect ratio. The user either already performed manualcropping, or used another offline procedure to manually or automaticallychange the aspect ratio in the current image. Either way, the algorithmdetects this and is biased in the expert direction and so the algorithmwill selectively fit the final constrained output aspect ratio box astightly to the image border as possible. Another way to automaticallyset this aggressiveness parameter is to look at the aspect ratiovariance of all images in a user's collection. Higher variances mean theuser is using different cameras, different shooting modes, switchingbetween portrait and landscape, and/or manually cropping images. Assuch, the higher the variance, the greater the bias towards expert mode;similarly, the lower the variance, the greater the bias towards amateur(default) mode. Similarly, by presenting side-by-side images to a userrepresenting cropped results as obtained from centering andrule-of-thirds cropping, a user's preference for a particular croppingalgorithm may be obtained, stored, and used accordingly.

In both example images 810 and 820, the algorithm was able to expandfrom the low priority region to the final constrained output aspectratio box while remaining within the image area. Had the requirementbeen to form a more extreme landscape or portrait output image aspectratio, the process of fitting the constrained output aspect ratio cropbox could have resulted in either padding the output image withhomogeneous non-content borders, sacrificing pixels inside the lowpriority region, or extending the original image by using additionalimage sources.

FIG. 9 illustrates an example wherein the requested output aspect ratiois 16:9. Starting image 910 is the same as images 810 and 820. Inparticular, two padding options are provided at decision box 940 asshown by images 920 and 930. The algorithm, as described above, willbranch to generate image 920 if it is disallowed to remove pixels fromthe low priority region 916. Often, the low priority region can be mademore pleasing by incorporating the image into a template or matte borderyielding pleasing results. In cases when this is not possible, the edgesof the image are padded with non-content borders (in the left and rightborders in this case). This can be undesirable in some instances, and soit is necessary to omit pixels from the low priority region as shown inthe algorithm branching to generate image 930.

If the input image 910 was part of a collection of images or if theimage had GPS information associated with it, we do have a third optionnot shown in FIG. 9. We could use scene matching, modeling cameraintrinsic and extrinsic parameters, and bundle adjustment or similartechniques to find other images taken at the same locale. For example,if we had a portrait image of two people standing in front of the Statueof Liberty, and we wanted to make a 16×9 constrained aspect ratio print,we typically would have to zoom in quite a bit, losing perhaps valuableinformation from the top and bottom of the original image. Usingtechniques described by Noah Snavely, Rahul Garg, Steven M. Seitz, andRichard Szeliski, “Finding Paths Through the World's Photos,” SIGGRAPH2008, which is incorporated herein by reference in its entirety, wecould not only find other images taken at the same location, but wecould seamlessly blend in information to the left and right of theoriginal image such that the final 16×9 constrained aspect ratio imagecould contain the full top and bottom of the Statue of Liberty.

When it is necessary to crop pixels from the low priority region 916,the following algorithm is performed, with reference to FIG. 10, inwhich an input image of 6:4 aspect ratio is recomposed to a requestedoutput aspect ratio of 25:10. This algorithm is equally applicable togenerate image 930 which illustrates al 6:9 aspect ratio.

-   -   1) The constrained aspect ratio crop region, which is the        requested output aspect ratio of 25:10, is digitally centered on        the low priority region 1016 such that the constraining        dimension extends from one end of the input image to the other        (left and right input image borders in 1020), and the center of        the cropped dimension (vertical) overlaps the center of the low        priority region (1020 is generated from a vertically centered        crop of low priority region 1016 while maintaining the requested        output aspect ratio). If no pixels from the low priority region        1016 are cropped out, cropping is complete. Otherwise, go to        step 2) to restart the procedure using the medium priority        region. Image 1020 shows a sample cropping, vertically centered        on 1016. Because pixels were cropped from low priority region        1016, we continue with step 2).    -   2) The constrained aspect ratio crop region is recentered on the        medium priority region 1015. If no pixels from the medium        priority region are cropped out after performing the same        procedure as on the low priority region described above in step        1), cropping is complete. Otherwise, go to step 3). 1030 shows a        sample cropping, vertically centered on the medium priority        region 1015. Because pixels were cropped from the medium        priority region 1015, we continue to step 3) to restart the        procedure using the high priority region.    -   3) Rather than proceeding with the steps as described above and        centering on the high priority region, empirical testing has        found that centering on a point slightly above a centroid of the        high priority region yields preferable results. Therefore, a        centroid of the constrained aspect ratio crop region is        identified and is situated on (overlaps) a point slightly above        the centroid of the high priority region. This point is located        40% of the total vertical height of the high priority region        measured from the top of the high priority region. 1040 shows a        sample cropping, using this 40/60 method.        4.0 Arbitration of Facial Regions

If Step 3) crops out any pixels from the high priority region and we hadpreviously determined we had multiple medium priority regions (asdemonstrated by 645 and 647 in FIG. 6A), a face arbitration step ensues.Face arbitration takes place at the medium priority region, the highpriority region; and at the individual face box level. If there is morethan one medium priority region, we first selectively ignore thesmallest medium priority region, but retain its corresponding highpriority region(s). If ignoring this smallest medium priority regionallows all high priority regions to fit in the final cropped imagedefined by the 25:10 aspect ratio output in this example, cropping iscomplete. Else, we first additionally ignore the high priority regioncorresponding to the just ignored smallest medium priority region, andthen ignore the second smallest medium priority region. This processcontinues until all remaining high priority regions fit and arerecognized in the final cropped image at the requested aspect ratio, oruntil we have only one medium priority region remaining that is notignored.

The order in which medium priority regions are ignored, in situationswhere there are multiple ones of these areas, can be controlledaccording to the size and location of such areas. A score is given toeach medium priority region, wherein lower scoring areas are ignoredfirst. Once such an area is ignored it means that the algorithm nolonger recognizes the medium priority region. The larger the area thehigher its score and the more central the area the higher its score.Formally, the medium priority region score is given by: (its area÷areaof input image)+(0.5×location of combined padded area). The first termyields a size indicator that varies between 0 and 1. The second term, orpadded area location is calculated by computing the distance between thecentroid of the combined padded area and the centroid of the inputimage, then dividing this by half of the minimum of the width or heightof the input image. This yields a value for the second term which alsovaries continuously between 0 and 1. Size has been deemed more importantthan location, and so is weighted twice as much by this formula. Lowestscoring medium priority regions are ignored first. It should be evidentto those skilled in the art how to expand the above formulas to includeother variants such as non-linear center to edge location and non-linearmedium priority region size. A centroid of a region is a point definedas the vertical midpoint and horizontal midpoint of the region, using asreference the furthest top, bottom, right and left points contained inthe region.

If only one medium priority region remains, and the entire high priorityregion cannot fit into the final cropped image, then arbitration at thehigh priority (face box) level is performed. Arbitration at the highpriority region level is invoked when there is only one medium priorityregion and the constrained aspect ratio crop removes pixels from thehigh priority region. Similar to arbitration at the combined paddedarea, we now rank individual face boxes, and start ignoring one face boxat a time until all pixels in the resulting highest priority region areincluded in the constrained aspect ratio crop box. Individual face boxesare once again weighted according to size, location, eye blink, gaze,facial expression, exposure, contrast, noise, and sharpness. As facearbitration eliminates faces, or in more general, as face regions orpadded face regions are ignored to adhere to constrained aspect ratio,the algorithm preferentially biases crop boundaries away from theignored areas to minimize occurrences of half of a face at the edge ofthe final constrained aspect ratio image.

Adding facial pose, eye blink, expression, exposure, noise, andsharpness into this scoring mechanism is more compute intensive, butyields more pleasing results. In FIG. 6B, a low eye blink and expressionscore at the individual face level caused face 662 to be ignored fromfurther processing. With respect to the medium priority region (combinedpadded face boxes), each eye blink or sideways eye gaze multiplies thecumulative combined medium priority region score by (1−1/n), where n isthe number of faces in the medium priority region. So, if there were twofaces in the medium priority region, and one person was blinking, thescore gets cut in half. If there were four faces, and one was blinkingand another looking off to the side, we multiply the medium priorityregion score by (¾)(¾)= 9/16. Facial expression can either increase ordecrease a padded face box score. Neutral faces have no effect, or amultiplier of 1. Preferred expressions (happy, excited, etc) increasethe box score with a multiplier above 1, and negative or undesirableexpressions decrease the overall score with a multiplier less than 1.These weights can be easily programmed into the present algorithm.Facial expressions are a little more forgiving than eye blink or eyegaze, but, overly sad, angry, fearful, or disgusted faces are rankedlow; while happy and surprised faces are ranked higher. Each face isassigned an expression value from 0.5 which is maximum negative to 1.5which is maximum positive. The expression values are then scaled by facesize such that larger faces have more weight, and the weighted averageis used as an expression multiplier for the entire medium priorityregion. Exposure, contrast, noise, and sharpness indicators similarlydecrease the weight of the padded face box if the face is toodark/light, high/low contrast, too noisy, and too blurry respectively.It should be obvious to those skilled in the art that these assignmentsof value to multipliers are arbitrary and can be made more complex, andnon-linear rules can also be devised.

It is also possible to expand face arbitration to include knownclustering relationships amongst people as per A. Gallagher, T. Chen,“Using Context to Recognize People in Consumer Images”, IPSJTransactions on Computer Vision and Applications, 2009. In this case, ifwe find face boxes in the upper portion of the image with one or moresmaller face boxes below them, we can often infer that the two upperfaces are the parents and the lower faces are the children. Similarly,if we find an upper face and then a lower face with a tilted pose, it isoften a child or baby being held by a parent. As such, if the entirehigh priority region cannot fit into the final cropped image, we canbreak the single high priority regions into multiple smaller face boxes(padded or not) based upon known parent-child, parent-infant, and adultcouple relationships. Similarly, prior knowledge of culture, community,and religion can be invoked. Further, segregation can be done by age,gender, identity, facial hair, glasses, hair type, hat, jewelry, makeup,tattoos, scars, or any other distinguishing characteristics. Usingclothing detection techniques such as described in A. Gallagher, T.Chen, “Clothing Cosegmentation for Recognizing People,” IEEE Conferenceon Computer Vision and Pattern Recognition, 2008, which is incorporatedherein by reference in its entirety, individual regions in a digitalimage can be segmented further by neckwear, clothing, or uniforms.

5.0 Softcopy Viewing of Crop Regions

An alternative implementation of the present invention includes usingthe algorithm for generating motion images in softcopy devices, such asdigital frames, TV's, computerized slide shows, or the like, whereinseveral crop variations from one single digital image can be output. Forexample, it is a simple matter to program an automatic display sequencewherein we start with displaying the low priority region of an image,then, in a continuous motion display, zooming in to its medium priorityregion, then zooming into its high priority region, and finally panningto each face box in the image one at a time. Clusters discovered eitherby face box size and pose, or by age, race, or gender recognition, or acombination thereof, can be zoomed into, such as just the parents, or ifthe daughters are on one side, zooming in to just the daughters, all asa continuous motion image. This kind of display has been referred to inthe art as the “Ken Burns effect.”

6.0 Padding Rules Used for Medium Priority Regions

Methods of forming the individual padded face boxes 631-635 in FIG. 6A,or more specifically, the individual padding around each face box usedin the construction of the medium priority regions 645 and 647 in FIG.6A will now be described. For example, although face detection returnsthe size and location of all faces, 611-615 in FIG. 6A, it has not beenexplained how to determine the size and location of the correspondingpadded face boxes, 631-635 in FIG. 6A. Typically, each padded face box631-635 is centered on and is slightly larger than the face box 611-615itself, but there are several mechanisms which control this padding,including different padding amounts to the left, right, top, and bottomof each face box. To aid this description, we introduce a unit ofmeasure called FaceWidth, where one FaceWidth is the larger of the widthor height of the face box returned from the face detection facility. Wealso introduce a variable called MinWidthHeight, which is the smaller ofthe input image's height or width.

The first mechanism that controls the padded face box size is therelationship between FaceWidth and MinWidthHeight. Smaller face boxesget larger padding. Larger face boxes get less padding. This is anon-linear relationship, 1100, as shown in FIG. 11. A FaceWidth lessthan or equal to 10% of the MinWidthHeight of the input image 1201, suchas face 1212, get the maximum padding 1211 of 2× FaceWidth on sides andtop of face. Faces 20% of MinWidthHeight, such as 1222, getapproximately 1× FaceWidth padding 1221, on sides and top of the face.Faces 40% of MinWidthHeight such as 1332 (face box not shown), getapproximately ½× FaceWidth padding 1331 on sides and top of the face.Faces greater than or equal to 80% MinWidthHeight such as 1442 (face boxnot shown), get approximately ¼× FaceWidth padding 1441 on sides and topof the face. These padding amounts are easily generally derivable fromthe graph shown in FIG. 11, are easily adjustable according to userpreference, and can be selected and stored in a computer system foraccess by a program that implements the algorithm.

As we are padding faces, we keep track if any of the padded sides in amedium priority region extend beyond the image boundary because one faceis too close to the edge of the digital image. If this happens,symmetric clipping is automatically performed on the opposite end ofthat particular medium priority region, making the medium priorityregion symmetric as shown in FIG. 15. The left side of the mediumpriority region 1540 is clipped 1550 by the same amount that the rightedge of the padded face area 1520 extends beyond the input image 1503boundary, so symmetric cropping is performed on the left 1510 and right1520 padded face boxes (boxes not shown).

The padding below the face box (downward pad) is regulated by the giveninput image aspect ratio to desired output aspect ratio as well as facebox size. The initial padding below the face is determined by the inputto output aspect ratios. This is a non-linear 2-D relationship as shownin FIG. 16. Small output aspect ratios correspond to portrait images,while large aspect ratios correspond to landscape images. The mappingfunction in FIG. 16 generally provides more downward padding in portraitshots, and less downward padding in landscape shots. It should be notedthat the algorithm is least aggressive on input images (horizontal axis)which are extreme portrait and whose output format (vertical axis) is anextreme landscape aspect ratio. This is reflected in the upper leftregion of the mapping in FIG. 16 where the multiple value of 1.0 islowest. FIG. 16 is a sample 2-D mapping, and those skilled in the artwill understand that any nonlinear relationship can be substituted.

With the initial downward pad generated by input to output aspect ratioas shown in FIG. 16, we now dampen the downward pad by face size. Largerfaces get more symmetric padding all around the face. Smaller faces getthe requested downward padding, with smaller dampening or withoutdampening, as determined by aspect ratio. FIG. 17 shows a samplenonlinear function 1720 that maps from 1.0 down to 1/downpad, wheredownpad is the downward padding as determined by the input to outputaspect ratio as shown in FIG. 16. This function is a piecewise linearfunction in which face boxes having a width less than or equal to 40% ofMinWidthHeight use the full face pad (1× scalar) and faces greater thanor equal to 60% MinWidthHeight have equal padding all around the face,i.e. maximum dampening which results in no extra downward padding. Allother faces are linearly interpolated between these two points. FIG. 18shows sample faces 1822 and 1832, who's face box (not shown) size isrelative to the height of input image boundary 1801, with top and sidepad sizes represented by 1821 and 1831 and demonstrate theface-size-variable downpad factor 1825 and 1835, respectively.

The algorithms described herein are all quite fast to compute on moderncomputer systems, whether workstation or hand held devices. In fact, therunning time is limited only by the face detection or facial featureextraction time. Empirical studies have shown that the methods describedherein outperform simpler face (size and location) based croppingmethods as well as more sophisticated main subject detectionmethods—even main subject detection methods that include face detection.For still imagery, the algorithm recommended cropping is automaticallyoutput, while, for video, the algorithm can automatically output asmooth transitioning motion image from tightly cropped faces (highpriority region), to loosely cropped faces (medium priority region), toideally composed images (low priority region), and back again, orinclude panning between any regions having any priority level. Further,not only can the video pan from one face to the next, but if clusters offaces are found, the video can automatically pan from one region to thenext with no user interaction. Finally, the automatically generated low,medium, and high priority crop regions, along with face box regions andfinal constrained output aspect ratio crop boxes can be saved back tothe file as meta-data, or saved to databases for subsequent usage.

Alternative Embodiments

Although the methods described herein are done so with respect to humanfaces, it should be obvious that these methods can be expanded toinclude any particular object of interest. For example, instead of humanfaces, we can extract regions based upon human body or human torso asdescribed in Ramanan, D., Forsyth, D. A. “Finding and Tracking PeopleFrom the Bottom Up,” CVPR 2003, which is incorporated herein byreference in its entirety. Similarly, using identical techniques used totrain human face detectors as described by Burghardt, T. Calic, J.,“Analysing Animal Behavior in Wildlife Videos Using Face Detection andTracking,” Vision, Image and Signal Processing, 2006, which isincorporated herein by reference in its entirety, we can train to findanimals of any sort, including pet dogs, cats, or even fish; or train onbacterium, viruses, or internal organs; or trained to find cars,military vehicles, or parts off an assembly line. Further, with theintroduction of depth cameras such as Microsoft's Kinect and silhouetteextraction techniques such as described in Shotton, Jamie et. al.“Real-Time Human Pose Recognition in Parts from Single Depth Images,”CVPR 2011, which is incorporated herein by reference in its entirety, itis common to find and track humans in real-time and such humans can besegmented by depth, pose, or gesture.

It will be understood that, although specific embodiments of theinvention have been described herein for purposes of illustration andexplained in detail with particular reference to certain preferredembodiments thereof, numerous modifications and all sorts of variationsmay be made and can be effected within the spirit of the invention andwithout departing from the scope of the invention. Accordingly, thescope of protection of this invention is limited only by the followingclaims and their equivalents.

PARTS LIST

-   101 Remote System-   102 Remote Control-   103 Mouse-   104 Keyboard-   105 Bus-   106 Remote Output-   107 Sensors-   108 Image Sensor-   109 Storage/Memory-   110 HDD-   111 Drive-   112 Removable Device-   113 Interface-   114 Slot-   115 Communication System-   116 Processor/CPU System-   117 Local Output-   118 Mouse-   119 Keyboard-   121 I/O Devices-   122 Scanner-   123 Printer-   124 I/O Device-   125 Housing-   200 Workstation/PC-   201 Control/Editing Area-   202 User-   209 Storage/Memory-   217 Local Output-   218 Mouse-   219 Keyboard-   220 Audio Sensor-   221 Image Sensor-   222 Sensor System-   310 Image-   320 Image-   321 Crop Border-   322 Crop Border-   326 Face Box-   327 Face Box-   330 Image-   340 Image-   341 Crop Border-   342 Crop Border-   346 Face Box-   347 Face Box-   350 Image-   410 Image-   430 Image-   435 Image-   450 Image-   455 Image-   510 Image-   520 Image-   521 Face Box-   522 Face Box-   523 Face Box-   524 Face Box-   525 Face Box-   530 Image-   535 Combined Face Box-   540 Image-   541 Padded Face Box-   542 Padded Face Box-   543 Padded Face Box-   550 Image-   555 Combined Padded Face Box-   560 Image-   565 Combined Padded Face Box-   567 Expanded Combined Padded Face Box-   610 Image-   611 Face Box-   612 Face Box-   613 Face Box-   614 Face Box-   615 Face Box-   618 Combined Face Box-   620 Image-   625 Combined Face Box-   627 Combined Face Box-   630 Image-   631 Padded Face Box-   632 Padded Face Box-   633 Padded Face Box-   634 Padded Face Box-   635 Padded Face Box-   640 Image-   641 Crop Border-   645 Combined Padded Face Box-   647 Combined Padded Face Box-   660 Image-   661 Face Box-   662 Face Box-   663 Face Box-   664 Face Box-   665 Face Box-   668 Combined Face Box-   670 Image-   675 Recognized Face Box-   677 Combined Face Box-   680 Image-   681 Padded Face Box-   682 Padded Face Box-   683 Padded Face Box-   684 Padded Face Box-   685 Padded Face Box-   690 Image-   691 Crop Border-   695 Recognized Padded Face Box-   696 Recognized Padded Face Box-   697 Recognized Combined Padded Face Box-   710 Image-   720 Image-   730 Image-   740 Image-   750 Image-   760 Decision Flow-   810 Image-   811 Face Box-   812 Face Box-   815 Combined Padded Face Box-   816 Expanded Combined Padded Face Box-   817 Constrained Expanded Combined Padded Face Box-   825 Combined Padded Face Box-   826 Expanded Combined Padded Face Box-   827 Constrained Expanded Combined Padded Face Box-   910 Image-   911 Face Box-   912 Face Box-   915 Combined Padded Face Box-   916 Expanded Combined Padded Face Box-   920 Image-   921 Face Box-   922 Face Box-   925 Combined Padded Face Box-   926 Expanded Combined Padded Face Box-   927 Original Image Border-   930 Image-   931 Face Box-   932 Face Box-   935 Combined Padded Face Box-   936 Expanded Combined Padded Face Box-   940 Decision Flow-   1010 Image-   1011 Face Box-   1012 Face Box-   1013 Combined Face Box-   1015 Medium Priority Region-   1016 Low Priority Region-   1020 Image-   1030 Image-   1040 Image-   1100 Function-   1201 Image-   1211 Padding-   1212 Face Box-   1221 Padding-   1222 Face Box-   1302 Image-   1331 Padding-   1332 Face-   1403 Image-   1441 Padding-   1442 Face-   1503 Image-   1510 Left Face Box-   1520 Right Face Box-   1540 Combined Padded Face Box-   1550 Symmetric Crop-   1710 Downpadding-   1720 Function-   1801 Image-   1821 Padding-   1822 Face-   1825 Downpadding-   1831 Padding-   1832 Face-   1835 Downpadding

The invention claimed is:
 1. A method, comprising: identifying, by acomputing device, two or more individual regions in a digital image thateach include a face; assigning, by the computing device, a fitness scoreto each of the two or more individual regions, wherein a fitness scorefor a particular region is based on a facial expression characteristicof the face corresponding to the particular region and an exposureamount of the face corresponding to the particular region, and whereinthe facial expression characteristic comprises a gaze direction;defining, by the computing device, a combined region based on thefitness score, wherein the combined region includes the two or moreindividual regions, wherein a border of the combined region is collinearwith a border of one of the two or more individual regions; determining,by the computing device, an average gaze direction based on the gazedirection of faces associated with the two or more individual regions;and defining, by the computing device, a gaze region that is based onthe average gaze direction.
 2. The method of claim 1, wherein eachborder of the combined region is collinear with a border of the two ormore individual regions.
 3. The method of claim 1, further comprisingmodifying the digital image such that the combined region satisfies arule of thirds composition.
 4. The method of claim 3, wherein the ruleof thirds composition is based on an adjustable parameter that specifiesan amount of expansion of an individual region.
 5. The method of claim1, further comprising modifying an aspect ratio of the digital image,wherein the modifying comprises deleting a portion of the digital imagesuch that the combined region is preserved without removing any of itspixels.
 6. The method of claim 1, further comprising modifying an aspectratio of the digital image such that a portion of only one of the two ormore individual regions is deleted, wherein the modifying the aspectratio is responsive to determining that modifying the aspect ratio ofthe digital image cannot be completed together with preserving thecombined region.
 7. The method of claim 1, further comprising detectingand issuing a notification that a portion of the combined region wouldbe deleted if a preselected modification of the digital image isexecuted.
 8. The method of claim 7, wherein the preselected modificationcomprises modifying an aspect ratio of the digital image.
 9. The methodof claim 1, further comprising determining a size of each of the two ormore individual regions, wherein determining the size of each of the twoor more individual regions comprises excluding at least one of the twoor more individual regions from the combined region if the size of theat least one of the two or more individual regions is smaller than alargest one of the two or more individual regions by a preselectedmagnitude.
 10. The method of claim 9, wherein the size of each of thetwo or more individual regions is determined by either an area or awidth of each of the two or more individual regions.
 11. The method ofclaim 1, further comprising: ignoring at least one of the two or moreindividual regions whose fitness score is below a preselected threshold,wherein the combined region includes two or more individual regionswhose fitness score is above the preselected threshold.
 12. The methodof claim 11, wherein the fitness score for a particular region isfurther based on a size and location of the face corresponding to theparticular region, and wherein the facial expression characteristic isfurther based on at least one of an eye blink, an expression, a pose, anocclusion, sharpness, or contrast.
 13. The method of claim 1, furthercomprising storing data for identifying the combined region, wherein thedata is stored in association with the digital image.
 14. The method ofclaim 1, further comprising zooming in or out of the combined region bya preselected amount to form a modified digital image.
 15. The method ofclaim 1, further comprising determining a width of at least one of thetwo or more individual regions including determining a size of a paddingregion based on the determined width, wherein the determined paddingregion corresponds to the at least one of the two or more individualregions.
 16. The method of claim 1, further comprising modifying anaspect ratio of the digital image such that equal amounts of thecombined region are cropped from opposing sides of the combined region,wherein the modifying the aspect ratio is responsive to determining thatmodifying the aspect ratio of the digital image cannot be completedtogether with preserving the combined region without removing any of itspixels.
 17. The method of claim 16, further comprising: detecting that aportion of the combined region would be cropped if a preselectedmodification of the digital image is executed; and issuing anotification based on the detecting that the portion of the combinedregion would be cropped if the preselected modification of the digitalimage is executed.
 18. The method of claim 1, further comprisingmodifying an aspect ratio of the digital image such that about fortypercent of a total amount cropped from the digital image is cropped froma top border of the digital image, wherein the modifying the aspectratio is responsive to determining that modifying the aspect ratio ofthe digital image cannot be completed together with preserving thecombined region without removing any of its pixels.
 19. A systemcomprising: a processor configured to: identify two or more individualregions in a digital image that each include a face; assign a fitnessscore to each of the two or more individual regions, wherein a fitnessscore for a particular region is based on a facial expressioncharacteristic of the face corresponding to the particular region and anexposure amount of the face corresponding to the particular region, andwherein the facial expression characteristic comprises a gaze direction;define a combined region that includes the two or more individualregions, wherein a border of the combined region is collinear with aborder of one of the two or more individual regions; determine anaverage gaze direction based on the gaze direction of faces associatedwith the two or more individual regions; and define a gaze region thatis based on the average gaze direction.
 20. A non-transitorycomputer-readable medium having instructions stored thereon, theinstructions comprising: instructions to identify two or more individualregions in a digital image that each include a face; instructions toassign a fitness score to each of the two or more individual regions,wherein a fitness score for a particular region is based on a facialexpression characteristic of the face corresponding to the particularregion and an exposure amount of the face corresponding to theparticular region, and wherein the facial expression characteristiccomprises a gaze direction; instructions to define a combined regionthat includes the two or more individual regions, wherein a border ofthe combined region is collinear with a border of one of the two or moreindividual regions; instructions to determine an average gaze directionbased on the gaze direction of the faces associated with the two or moreindividual regions; and instructions to define a gaze region that isbased on the average gaze direction.
 21. The method of claim 1, furthercomprising determining a vector indicating a gaze orientation of theface corresponding to each of the two or more individual regions,wherein the gaze direction is based on the determined vector.
 22. Themethod of claim 1, wherein the gaze region does not include the combinedregion.
 23. The method of claim 1, wherein the gaze region comprises aregion of the digital image that extends from the border of the combinedregion to a point on the digital image that is in the average gazedirection.
 24. The method of claim 1, further comprising determining, bythe computing device, an output image that includes the combined regionand the gaze region.